import { enemyPlane } from "../component/enemyPlane";
import emitter from "../emitter";

const { ccclass, property } = cc._decorator;

@ccclass
export default class enemyPlane_3 extends enemyPlane {
    @property(cc.Integer)
    createTime = 0;
    @property(cc.Integer)
    createNum = 0;

    blood;
    uiItem;
    onLoad() {
        this.uiItem = this.node.getComponent("enemyPlaneUI");
        let self = this;
        this.schedule(() => {
            self.createEnemyPlane();
        }, this.createTime)
    }

    getBlood() {
        return this.uiItem.blood;
    }

    setBlood() {
        this.uiItem.setBloodProgress(this.uiItem.blood / 2);
    }

    createEnemyPlane() {
        emitter.emit("createPlane", this.createNum, 12, this.getBlood(), this.node.position);
        this.setBlood();
    }
}
